package com.aster.common.api.controller;

import com.aster.common.api.service.SmsCheckService;
import com.aster.common.exception.ServiceException;
import com.aster.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
public class SmsController {

    @Autowired
    SmsCheckService smsCheckService;

    @RequestMapping("/sendLoginCode")
    R sendLoginCode(String tel){
        try {
            smsCheckService.sendSmsCode(tel);
            return R.ok();
        }catch (ServiceException ex){
            return R.error(55555,ex.getMsg());
        }
    }
}
